<script lang="tsx" setup>
/**
 * 主体
 */
import {defineSheetForm, SheetForm} from "../../../../index.ts"
import {ref} from "vue"

/**
 * 表单实例
 */
const sheetFormRef = ref()
const sheetForm = defineSheetForm<any>({
  labelWidth: "90px",
  els: [
    {
      label: "请求地址",
      eType: "el-input",
      prop: "url"
    },
    {
      label: "是否初始化",
      eType: "el-switch",
      prop: "getImmediate"
    },
    {
      label: "自定义参数",
      eType: "el-input",
      prop: "otherParams",
      props: {
        type: "textarea"
      }
    }
  ]
})

/**
 * 获取数据
 */
const getFormData = async () => {
  return await sheetFormRef.value.getFormData()
}

/**
 * 设置数据
 */
const setFormData = (value: any) => {
  sheetFormRef.value.setFormData(value)
}

/**
 * 暴露
 */
defineExpose({
  getFormData,
  setFormData
})
</script>

<template>
  <SheetForm ref="sheetFormRef" :SheetFormModel="sheetForm"/>
</template>

<style lang="scss" scoped>

</style>